'''
Created on Mar 10, 2010

@author: Nick Heiner
'''
from models import Item

RESTOCK_LEVEL = 30

def main():
    items = Item.all().filter("quantity <", 10)
    restocked_at_least_once = False; # a bit clumsy
    for item in items:
        item.quantity = RESTOCK_LEVEL
        item.put()
        restocked_at_least_once = True;
        print "Item %d (%s) restocked." % (item.CSIN, item.name)
        
    if not restocked_at_least_once:
        print "Nothing needed to be restocked." 
        
if __name__ == "__main__":
    main()